{extend name='public/modal'}
{block name='content'}
<style type="text/css">
    .submit_btn{
         float: center;
  }
</style>
<form action="edit_patient" class="layui-form layui-form-pane" id="mainForm" method="post">
        <input name="id" id="id" value="{$data.id}" style="display: none">
        <div class="layui-form-item">
                <label class="layui-form-label">
                    卡号
                </label>
                <div class="layui-input-block">
                    <input name="card_id" class="layui-input" id="card_id" value="{$data.card_id}" {if condition="$data.card_id!=''"} disabled {/if}>
                </div>
            </div>
    
            <div class="layui-form-item">
                <label class="layui-form-label">
                    绑定手机
                </label>
                <div class="layui-input-block">
                    <input name="phone_id" class="layui-input" id="phone_id" value="{$data.phone_id}" {if condition="$data.phone_id!=''"} disabled {/if}>
                </div>
            </div>
    
            <div class="layui-form-item">
                <label class="layui-form-label">
                    姓名
                </label>
                <div class="layui-input-block">
                    <input type="username" name="name" class="layui-input" id="name" value="{$data.name}" placeholder="姓名">
                </div>
            </div>
    
            <div class="layui-form-item">
                <label class="layui-form-label">
                    联系电话
                </label>
                <div class="layui-input-block">
                    <input name="phone" class="layui-input" id="phone" value="{$data.phone}" placeholder="联系电话">
                </div>
            </div>
    
    
            <div class="layui-form-item">
                <label class="layui-form-label">
                    性别
                </label>
                <div class="layui-input-block">
                    <input type="radio" name="sex" id="sex" value="1" title="男" {if condition="$data.sex==1"} checked="" {/if}>
                    <input type="radio" name="sex" id="sex" value="2" title="女" {if condition="$data.sex==2"} checked="" {/if}>
                    <input type="radio" name="sex" id="sex" value="0" title="不详" {if condition="$data.sex==0"} checked="" {/if}>
                </div>

            </div>
    
    
            <div class="layui-form-item">
                <label class="layui-form-label">
                    年龄
                </label>
                <div class="layui-input-block">
                    <input type="number" name="age" class="layui-input" id="age" value="{$data.age}" placeholder="年龄">
                </div>
            </div>
    
            <div class="layui-form-item">
                <label class="layui-form-label">
                    身高
                </label>
                <div class="layui-input-block">
                    <input name="height" class="layui-input" id="height" value="{$data.height}" placeholder="身高">
                </div>
            </div>
    
            <div class="layui-form-item">
                <label class="layui-form-label">
                    体重
                </label>
                <div class="layui-input-block">
                    <input name="weight" class="layui-input" id="weight" value="{$data.weight}" placeholder="体重">
                </div>
            </div>
        
            <div class="layui-form-item">
                <label class="layui-form-label">
                    血型
                </label>
                <div class="layui-input-block">
                    <input name="blood" class="layui-input" id="blood" value="{$data.blood}" placeholder="血型">
                </div>
            </div>
    
            <div class="layui-form-item">
                <label class="layui-form-label">
                    出生年月
                </label>
                <div class="layui-input-block">
                    <input name="birth" class="layui-input" id="birth" value="{$data.birth}" placeholder="出生年月">
                </div>
            </div>
    
            <div class="layui-form-item">
                <label class="layui-form-label">
                    身份证
                </label>
                <div class="layui-input-block">
                    <input name="idcard" class="layui-input" id="idcard" value="{$data.idcard}" placeholder="身份证">
                </div>
            </div>
    
            <div class="layui-form-item">
                <label class="layui-form-label">
                    住址
                </label>
                <div class="layui-input-block">
                    <input name="address" class="layui-input" id="address" value="{$data.address}" placeholder="住址">
                </div>
            </div>
    
            <div class="layui-form-item">
                <label class="layui-form-label">
                    微信
                </label>
                <div class="layui-input-block">
                    <input name="wechat" class="layui-input" id="wechat" value="{$data.wechat}"  placeholder="请输入微信">
                </div>
            </div>
    
            <div class="layui-form-item">
                <label class="layui-form-label">
                    邮箱
                </label>
                <div class="layui-input-block">
                    <input type="email" name="email" class="layui-input" id="email" value="{$data.email}" placeholder="请输入电子邮箱">
                </div>
            </div>
    
            <div class="layui-form-item">
                <label class="layui-form-label">状态</label>
                <div class="layui-input-block">
                    <input type="checkbox" {if condition="$data.status==1"} checked="" {/if} name="status" id="status"  lay-skin="switch" lay-filter="switchTest" lay-text="开启|关闭">
                </div>
            </div>



        <div class="layui-form-item">
            <div class="layui-input-block submit_btn">
                <button type="submit" class="layui-btn layui-btn-success">保存</button>
            </div>
        </div>
</form>
{/block}
{block name='js'}
<script type="text/javascript">
    $(function(){
        var options = {
              type:'post',           //post提交
              //url:'http://ask.tongzhuo100.com/server/****.php?='+Math.random(),   //url
              dataType:"json",        //json格式
              data:{id:"{$data.id}"},    //如果需要提交附加参数，视情况添加
              clearForm: false,        //成功提交后，清除所有表单元素的值
              resetForm: false,        //成功提交后，重置所有表单元素的值
              cache:false,
              async:false,          //同步返回
              success:function(data){
                    if(data.code==0){
                      layer.msg(data.msg);
                    }else{
                      layer.msg(data.msg,{icon:1,time:500},function(){
                        $("#reset").click();
                        lotus_close();
                        parent.location.reload();
                      });
                    }
                  //服务器端返回处理逻辑
                },
                error:function(XmlHttpRequest,textStatus,errorThrown){
                  layer.msg('操作失败:服务器处理失败');
              }
            };
          layui.use('form', function(){
            var form = layui.form;
            $('#mainForm').ajaxForm(options).submit(function(data){});
          });

        })
      // });
</script>
{/block}
